Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

How to copy image in NSPasteBoard

To copy the image on NSPasteBoard following code can be used: - (IBAction)paste:sender { NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; NSArray *classArray = [NSArray arrayWithObject:[NSImage class]]; ...

How to print an NSImage

The following code prints an image stored in a file: -(void)print:(id)sender { NSImage *image = [[NSImage alloc]initWithContentsOfFile:[imageEdWindowController getImageLocation]]; [image scalesWhenResized]; NSImageView *&#9...

How to send email in mac os

Following code can be use to send email in mac os: -(IBAction)sendEmailClicked:(id)sender { NSString *recipient; NSString *mailsender; NSString *mailsubject; NSString *mailmessage; recipient = [reciever stringValue]; ...

How to convert NSImage to NSImageRep

You can convert NSImage to NSImageRep by using the following method: - (NSImageRep*)bitmapImageRepresentation:(NSImage*)image { NSArray *ret =[image representations]; for(NSImageRep *rep in ret) if([rep isKindOfClass:[NSIma...

How to convert NSImage to CIImage

To convert NSImage to CIImage following function can be used. -(CIImage*)fromNSImage:(NSImage*)image { NSData * tiffData = [image TIFFRepresentation]; NSBitmapImageRep * bitmap; bitmap = [NSBitmapImageRep imageRepWithData:tiff...

How to convert CIImage to NSImage

You can convert CIImage to NSImage by using the following function: -(NSImage*)fromCIImage:(CIImage*)ciImage { NSCIImageRep *imageRep = [NSCIImageRep imageRepWithCIImage:ciImage]; NSImage *_image = [[NSImage alloc] initWithSize:[ima...

How to redirect console logs to a file

To redirect the log statements to a file instead of console call the following function at the start of function applicationDidFinishLaunching. - (void)redirectConsoleLogToDocumentFolder { NSArray *paths = NSSearchPathForDirectoriesInDom...

Use of NSSharingServicePicker

The NSSharingServicePicker class presents a list of sharing services, so that the user can choose a service to share an item. When a service is chosen, the picker automatically executes it, which presents the sharing window. + (NSMenu *)menuFo...

To setup custom webroot for Apache in Maverick

Apache by default serves files from the Document root i.e. /Library/WebServer/Documents/ But what if you want your custom folder to serve webfiles. This tutorial walks you through the complete process. Create a new folder at the root lev...

NSSplitView delegate for controlling minimum and maximum sizes of views

NSSplitView have delegate methods where we control the minimum and maximum sizes of sections and which views expand or collapse by what amount. Constraining the coordinates in the splitView:constrainMinCoordinate:ofSubviewAt: sets the minimum ...

NSSplitView delegate for priority based resizing

The default resizing mechanism in NSSplitView is proportional resizing in which if the NSSplitView changes size, each column resizes by an equal percent. But it is not successful in case where the columns in a split view are used to separate a si...

Cut image through code in mac os

Method to cut image in Objective-c/cocoa (OSX) -(IBAction)cutItem:(id)sender { hasBeenDragged = NO; NSImage *_sourceImage = [self image]; float width = selectedArea.size.width; float height = selectedArea.size.height; ...

Crop image in mac os

If you want to crop the image without changing its quality in Objective-c/cocoa (OSX) then you can use the following method -(IBAction)crop:(id)sender{ hasBeenDragged = NO; NSImage *_sourceImage = [self image]; float width = sel...

How to open OpenPanel in mac os

static NSArray *openFiles() { bookmarkMode = 0; NSOpenPanel *panel; NSMutableArray *extension=[[NSMutableArray alloc]init ]; [extension addObject:[[NSUserDefaults standardUserDefaults]objectForKey:@"ImageExtension" ] ]; ...

Open zip file through code in mac os

Method to open zip file -(void)unZipImages:(NSArray*)arguments { NSTask *unzipTask = [[NSTask alloc] init]; [unzipTask setLaunchPath:@"/user/bin/unzip"]; //this is where the unzip application is on the system. [unzipTask setC...

How to rotate image in mac os

-(NSImage*)rotateImage:(CGFloat)degrees { NSImage *_image = [YourImageController image]; NSRect imageBounds = {NSZeroPoint, [_image size]}; NSBezierPath *boundsPath = [NSBezierPath bezierPathWithRect:imageBoun...

View Hidden Files and Folders In Macintosh

I just love to work on Mac but sometimes a small task can become a herculean task in no time. Ever wondered where is the option to view hidden files and folders on Mac just like Windows has ? Frisking through all the options I realized that the...
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: